package secondriver.springsubway.example.jpa;

import javax.persistence.PostLoad;
import javax.persistence.PostPersist;
import javax.persistence.PostRemove;
import javax.persistence.PostUpdate;
import javax.persistence.PrePersist;
import javax.persistence.PreRemove;
import javax.persistence.PreUpdate;

/**
 * Entity Outer Callback
 * @author secondriver
 *
 */
public class PersonListener {

	@PostLoad
	public void postLoad(Object obj) {
		System.out.println("Loading Entity Bean:" + obj.getClass().getName());
	}

	@PrePersist
	public void prePersist(Object obj) {
		System.out.println("Persist Entity Bean Before:"
				+ obj.getClass().getName());
	}

	@PostPersist
	public void postPersist(Object obj) {
		System.out.println("Persist Entity Bean After:"
				+ obj.getClass().getName());
	}

	@PreUpdate
	public void preUpdate(Object obj) {
		System.out.println("Update Entity Bean Before:"
				+ obj.getClass().getName());
	}

	@PostUpdate
	public void postUpdate(Object obj) {
		System.out.println("Update Entity Bean After:"
				+ obj.getClass().getName());
	}

	@PreRemove
	public void preRemove(Object obj) {
		System.out.println("Remove Entity Bean Before:"
				+ obj.getClass().getName());
	}

	@PostRemove
	public void postRemove(Object obj) {
		System.out.println("Remove Entity Bean After:"
				+ obj.getClass().getName());
	}

}
